package controls.challengeHistory {
	
	import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
	
	/**
	 * @author Brent Kersanske
	 */ 
	public class ChallengeHistoryStyleFunctions	{
		
		/**
		 * Style function for the challenge predicate column.
		 */ 
		public static function styleChallengePredicate(data:Object, col:AdvancedDataGridColumn):Object {
			if( ((Number(data[col.dataField]) % 2) > 0) ||
			    (Number(data[col.dataField])      >= 128)) {
				return {color: 0x00CC00, fontWeight: "bold"};	
			} 
			return {};
		}
		
		/**
		 * Style function for the challenge kind column.
		 */ 
		public static function styleChallengeKind(data:Object, col:AdvancedDataGridColumn):Object {
			if(data[col.dataField] == "all") {
				return {color: 0x000000}; 	
			} else if(data[col.dataField] == "secret") {
				return {color: 0x0000FF, fontStyle: "italic"};		
			}
			return {};
		}
		
		/**
		 * Style function for the challenge result column.
		 */ 
		public static function styleChallengeResult(data:Object, col:AdvancedDataGridColumn):Object {
			if(data[col.dataField] == "Profit") {	
				return {color: 0x00CC00, backgroundColor: 0x000000};
			} else if(data[col.dataField] == "Loss") {
				return {color: 0xFF0000, fontWeight: "bold"};
			}
			return {};
		}
		
		/**
		 * Style function for columns that display relativistic values.
		 */ 
		public static function styleRelativeValue(data:Object, col:AdvancedDataGridColumn):Object {
        	var node:XML = XML(data);
       		return {};
		}
	}
}